home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 2 / AACD 2.iso / AACD / Programming / jikes-1.02 / src / configure.in < prev    next >
Encoding:
Text File  |  1999-09-05  |  9.0 KB  |  332 lines

  1. # $Id: configure.in,v 1.11 1999/08/25 12:11:06 shields Exp $
  2. dnl    This file is an input file used by the GNU "autoconf" program to
  3. dnl    generate the file "configure", which is run to configure the
  4. dnl    Makefile in this directory.
  5. AC_INIT(jikes.cpp)
  6.  
  7. # Convert srcdir into full path name
  8. srcdir=`cd $srcdir ; pwd`
  9. echo "srcdir is $srcdir"
  10.  
  11.  
  12. #--------------------------------------------------------------------
  13. #    see if --with-jikespg location is given on the command line
  14. #--------------------------------------------------------------------
  15.  
  16. AC_ARG_WITH(jikespg, [  --with-jikespg=PROG     location of jikes parser generator (optional)],
  17.     JIKESPG=$withval, JIKESPG=NONE)
  18.  
  19. if test "$JIKESPG" != "NONE"; then
  20.     if test ! -f "$JIKESPG" || test ! -x "$JIKESPG"; then
  21.         AC_MSG_ERROR([jikespg argument '$JIKESPG' is not a file or is not executable])
  22.     fi
  23. else
  24.     JIKESPG=jikespg
  25. fi
  26.  
  27.  
  28. #--------------------------------------------------------------------
  29. #    see if --with-icc is given on the command line
  30. #--------------------------------------------------------------------
  31.  
  32. AC_ARG_WITH(icc, [  --with-icc=PROG         use the IBM Cset++ compiler, optional PROG can be given instead of searching on the PATH],
  33.     CC=$withval, CC=NONE)
  34.  
  35. if test "$CC" != "NONE"; then
  36.     if test "$CC" = yes; then
  37.         AC_PATH_PROG(CC, icc)
  38.  
  39.         if test "$CC" = ""; then
  40.             AC_PATH_PROG(CC, xlC)
  41.  
  42.             if test "$CC" = ""; then
  43.                 AC_MSG_ERROR([could not find icc or xlC on your PATH.])
  44.             fi
  45.         fi
  46.     fi
  47.  
  48.     if test ! -f "$CC" || test ! -x "$CC"; then
  49.         AC_MSG_ERROR([argument '$CC' is not a file or is not executable])
  50.     fi
  51.  
  52.     CC_NAME=icc
  53.     CCREQUIREDFLAGS="-c -DICC"
  54.     CCOPTFLAGS="-O2"
  55.     CCDEBUGFLAGS="-DTEST"
  56.     LD=$CC
  57.     LDDEBUGFLAGS="-g"
  58.     LDFLAGS='-L. -o $(EXECUTABLE)'
  59. fi
  60.  
  61.  
  62.  
  63.  
  64. #--------------------------------------------------------------------
  65. #    see if --with-CC is given on the command line
  66. #--------------------------------------------------------------------
  67.  
  68. AC_ARG_WITH(CC, [  --with-CC=PROG          use the AT&T CC compiler, optional PROG can be given instead of searching on the PATH],
  69.     CC=$withval, CC=NONE)
  70.  
  71. if test "$CC" != "NONE"; then
  72.     if test "$CC" = yes; then
  73.         AC_PATH_PROG(CC, CC)
  74.         if test "$CC" = ""; then
  75.             AC_MSG_ERROR([could not find CC on your PATH.])
  76.         fi
  77.     fi
  78.  
  79.     if test ! -f "$CC" || test ! -x "$CC"; then
  80.         AC_MSG_ERROR([argument '$CC' is not a file or is not executable])
  81.     fi
  82.  
  83.     CC_NAME=CC
  84.  
  85.     CCREQUIREDFLAGS="-c -ansi"
  86.     CCOPTFLAGS="-fast"
  87.     CCDEBUGFLAGS="-DTEST -g -xs"
  88.     LD=$CC
  89.     LDDEBUGFLAGS="-g"
  90.     LDFLAGS='-L. -o $(EXECUTABLE)'
  91. fi
  92.  
  93. #--------------------------------------------------------------------
  94. # If no other compiler was given as a --with option then we use g++
  95. #--------------------------------------------------------------------
  96.  
  97. if test "$CC_NAME" = ""; then
  98.     AC_PROG_CXX
  99.  
  100.     CC_NAME=$CXX
  101.     CC=$CXX
  102.  
  103.     TEST_BOOL="true"
  104.     CCREQUIREDFLAGS="-c -ansi"
  105.     CCOPTFLAGS="-O2"
  106.     CCDEBUGFLAGS="-DTEST -g"
  107.     LD=$CC
  108.     LDDEBUGFLAGS="-g"
  109.     LDFLAGS='-L. -o $(EXECUTABLE)'
  110.  
  111.     if test "$GXX" != "yes"; then
  112.         LDFLAGS="$LDFLAGS -lm"
  113.     fi
  114. fi
  115.  
  116. #--------------------------------------------------------------------
  117. #   see if "bool" is a builtin type
  118. #--------------------------------------------------------------------
  119.  
  120. AC_LANG_CPLUSPLUS
  121.  
  122. AC_MSG_CHECKING(builtin bool type)
  123. AC_TRY_COMPILE([],[
  124. bool some_boolean_value = true;
  125. ], [
  126. CCREQUIREDFLAGS="$CCREQUIREDFLAGS -DTYPE_bool"
  127. AC_MSG_RESULT(yes)
  128. ],[
  129. AC_MSG_RESULT(no)
  130. ])
  131.  
  132.  
  133. # echo the compiler we are using
  134.  
  135. AC_MSG_CHECKING([for the compiler to use])
  136. AC_MSG_RESULT([$CC.])
  137.  
  138.  
  139. # defaults under UNIX
  140.  
  141. ERASE="rm -f"
  142. O=o
  143. EXECUTABLE=jikes
  144.  
  145.  
  146.  
  147. # Figure out what platform we are running on so that we know
  148. # what flags to give to the compiler
  149.  
  150.  
  151. # Keep case statements in alphabetical order.
  152. case "`uname -s`" in
  153.     AIX)
  154.         if test $CC_NAME = icc; then
  155.             CCREQUIREDFLAGS="$CCREQUIREDFLAGS -langlvl=ansi -qnotempinc -+ -qinlglue"
  156.             CCDEBUGFLAGS="$CCDEBUGFLAGS -g"
  157.         fi
  158.  
  159.         CCREQUIREDFLAGS="$CCREQUIREDFLAGS -DUNIX -DBIGENDIAN"
  160.         LDFLAGS="$LDFLAGS $LDDEBUGFLAGS"
  161.         ;;
  162.     FreeBSD)
  163.     CCREQUIREDFLAGS="$CCREQUIREDFLAGS -DUNIX -DIEEE_DIV_0 -DGNU_LIBC5 -DNO_WCHAR_H"
  164.  
  165.         if test $CC_NAME = "$CXX"; then
  166.             CCREQUIREDFLAGS="-funsigned-char $CCREQUIREDFLAGS"
  167.         fi
  168.  
  169.     # FreeBSD doesn't have the wchar.h functions yet
  170.     CCREQUIREDFLAGS="$CCREQUIREDFLAGS -DGNU_LIBC5 -DNO_WCHAR_H"
  171.  
  172.     # Check byte-order
  173.         case "`uname -m`" in
  174.             alpha)
  175.                 ;;
  176.             i?86)
  177.                 ;;
  178.             *)
  179.                 AC_MSG_ERROR([FreeBSD arch '`uname -m`' not supported.])
  180.                 ;;
  181.         esac
  182.     ;;
  183.     HP-UX)
  184.         if test $CC_NAME = "$CXX"; then
  185.             CCREQUIREDFLAGS="-funsigned-char $CCREQUIREDFLAGS"
  186.         fi
  187.         CCREQUIREDFLAGS="$CCREQUIREDFLAGS -DUNIX -D_INCLUDE_POSIX_SOURCE"
  188.         CCREQUIREDFLAGS="$CCREQUIREDFLAGS -DBIGENDIAN -DSTAT_POSIX_1"
  189.         LDFLAGS="$LDDEBUGFLAGS $LDFLAGS -lstdc++"
  190.         ;;
  191.     IRIX)
  192.         CCREQUIREDFLAGS="$CCREQUIREDFLAGS -DUNIX -DBIGENDIAN"
  193.         if test ! $GAS = yes; then
  194.             CCREQUIREDFLAGS="$CCREQUIREDFLAGS -mmips-as"
  195.         fi
  196.         ;;
  197.     Linux)
  198.     CCREQUIREDFLAGS="$CCREQUIREDFLAGS -DUNIX"
  199.  
  200.         if test $CC_NAME = "$CXX"; then
  201.             CCREQUIREDFLAGS="-funsigned-char $CCREQUIREDFLAGS"
  202.         fi
  203.  
  204.         case "`uname -m`" in
  205.             alpha)
  206.                 ;;
  207.             i?86)
  208.                 ;;
  209.         mips)
  210.         ;;
  211.             m68k)
  212.                 CCREQUIREDFLAGS="$CCREQUIREDFLAGS -DBIGENDIAN"
  213.                 ;;
  214.             ppc)
  215.                 CCREQUIREDFLAGS="$CCREQUIREDFLAGS -DBIGENDIAN"
  216.                 ;;
  217.             sparc)
  218.                 CCREQUIREDFLAGS="$CCREQUIREDFLAGS -DBIGENDIAN"
  219.                 ;;
  220.             *)
  221.                 AC_MSG_ERROR([Linux arch '`uname -m`' not supported.])
  222.                 ;;
  223.         esac
  224.         
  225.         # test to see if we are using libc5 or gnulib5 (libc6)
  226.         if test -f /lib/libc.so.5 && test ! -f /lib/libc.so.6; then
  227.             CCREQUIREDFLAGS="$CCREQUIREDFLAGS -DGNU_LIBC5"
  228.         else
  229.             CCREQUIREDFLAGS="$CCREQUIREDFLAGS -DSTAT_POSIX"
  230.         fi
  231.         ;;
  232.     OS2)
  233.         if test $CC_NAME = icc; then
  234.            O=obj
  235.            CCREQUIREDFLAGS="-Tdp -G5 $CCREQUIREDFLAGS -DUNIX_FILE_SYSTEM -Dcerr=cout"
  236.            CCOPTFLAGS="$CCOPTFLAGS -Tdp -O -DNDEBUG"
  237.            CCDEBUGFLAGS="$CCDEBUGFLAGS -Ti"
  238.            LDDEBUGFLAGS="/Ti+"
  239.            LDFLAGS="$LDFLAGS /O:\$(EXECUTABLE) /PM:VIO /STACK:400000 /NOE"
  240.  
  241.            # link to an obj file in the icc directory
  242.            TMP=$CC
  243.            TMP=`dirname $TMP`
  244.            TMP=`dirname $TMP`
  245.            SYSOBJECTS="$TMP\\lib\\setargv.obj"
  246.         fi    
  247.         ;;
  248.     OSF1)
  249.         CCREQUIREDFLAGS="$CCREQUIREDFLAGS -DUNIX"
  250.         ;;
  251.     SunOS)
  252.         CCREQUIREDFLAGS="$CCREQUIREDFLAGS -DUNIX -DBIGENDIAN"
  253.  
  254.         case "$CC_NAME" in
  255.             "$CXX")
  256.                 CCREQUIREDFLAGS="-funsigned-char $CCREQUIREDFLAGS"
  257.                 ;;
  258.             icc)
  259.                 CCREQUIREDFLAGS="-langlvl=ansi -+ -qnotempinc $CCREQUIREDFLAGS"
  260.                 CCOPTFLAGS="$CCOPTFLAGS -O3 -qstrict"
  261.                 CCDEBUGFLAGS="$CCDEBUGFLAGS -g"
  262.                 LDFLAGS="$LDFLAGS -Bstatic"
  263.                 ;;
  264.         esac
  265.     ;;
  266.     AmigaOS)
  267.         CCREQUIREDFLAGS="$CCREQUIREDFLAGS -DBIGENDIAN -Dstat=mystat -Dfopen=myfopen -Dopendir=myopendir"
  268.     SYSOBJECTS="-noixemul"
  269.  
  270.         case "$CC_NAME" in
  271.             ?++)
  272.                 CCREQUIREDFLAGS="-funsigned-char $CCREQUIREDFLAGS"
  273.                 ;;
  274.         esac
  275.     ;;
  276.     *)
  277.         AC_MSG_ERROR([platform '`uname -s`' is not supported.])
  278.         ;;
  279. esac
  280.  
  281.  
  282. #--------------------------------------------------------------------
  283. #    see if --enable-symbols was given, if so use debug symbols
  284. #--------------------------------------------------------------------
  285.  
  286. AC_ARG_ENABLE(symbols, [  --enable-symbols        build with debugging symbols],
  287.     [DEBUG_SYMBOLS=$enableval], [DEBUG_SYMBOLS=no])
  288.  
  289. if test "$DEBUG_SYMBOLS" = "yes"; then
  290.     CCFLAGS='$(CCREQUIREDFLAGS) $(CCDEBUGFLAGS)'
  291. else
  292.     CCFLAGS='$(CCREQUIREDFLAGS) $(CCOPTFLAGS)'
  293.     LDFLAGS="-s $LDFLAGS"
  294. fi
  295.  
  296.  
  297. #--------------------------------------------------------------------
  298. #     Check for libc brokenness (linux libc5, maybe others?) - CSA
  299. #--------------------------------------------------------------------
  300. AC_CACHE_CHECK(for a broken wchar.h, jikes_cv_broken_wchar,
  301.     AC_TRY_COMPILE([#include <wchar.h>],[wint_t foo;],
  302.     jikes_cv_broken_wchar=no, jikes_cv_broken_wchar=yes))
  303. if test $jikes_cv_broken_wchar = yes; then
  304.     AC_TRY_COMPILE([
  305. #include "libc5-fix.h"
  306. #ifndef __amigaos__
  307. #include <wchar.h>
  308. #endif
  309. ],[wint_t foo;],
  310.     CCREQUIREDFLAGS="$CCREQUIREDFLAGS -include libc5-fix.h",
  311.     AC_MSG_ERROR([Can't fix broken wchar.h]))
  312. fi
  313.  
  314. # Subst variables into Makefile.in to produce the Makefile
  315.  
  316. BUILD_DIR=`pwd`
  317. AC_SUBST(BUILD_DIR)
  318.  
  319. AC_SUBST(CC)
  320. AC_SUBST(CCREQUIREDFLAGS)
  321. AC_SUBST(CCDEBUGFLAGS)
  322. AC_SUBST(CCOPTFLAGS)
  323. AC_SUBST(CCFLAGS)
  324. AC_SUBST(ERASE)
  325. AC_SUBST(EXECUTABLE)
  326. AC_SUBST(LD)
  327. AC_SUBST(LDFLAGS)
  328. AC_SUBST(O)
  329. AC_SUBST(SYSOBJECTS)
  330.  
  331. AC_OUTPUT([Makefile])
  332.